
#include <dlfcn.h>
#include <iostream>
#include <stdio.h>
#include "sub/sub.h"
#include <vector>
#include <map>

using namespace std;

extern int c_sub(int a, int b);

class Solution
{
public:
    vector<int> twoSum(vector<int> &nums, int target)
    {
        map<int, int> mTmp;
        for (size_t i = 0; i < nums.size(); i++)
        {
            if (nums[i] >= target)
            {
                continue;
            }
            map<int, int>::iterator it = mTmp.find(target - nums[i]);
            if (it != mTmp.end())
            {
                vector<int> ret;
                ret.push_back(it->second);
                ret.push_back(i);
                return ret;
            }
            mTmp.insert(make_pair(nums[i], i));
        }
        return {};
    }
};

int main(int numArgs, const char *args[])
{
    Solution x;
    vector<int> nums;
    nums.push_back(2);
    nums.push_back(7);
    nums.push_back(9);
    nums.push_back(11);
    int target = 9;
    vector<int> t11 = x.twoSum(nums, target);
    printf("%d-%d\r\n", t11[0], t11[1]);
    // printf("enter main!\n");

    // printf("%d\n", c_sub(1, 1));
    // printf("%d\n", my_sub(2, 1));
}
